﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Locator.BusinessEntities
{
    /// <summary>
    /// Extended properties of the products class
    /// </summary>
    public partial class Products2
    {
        /// <summary>
        /// Gets the name of the product.
        /// </summary>
        [DataMember]
        public string Name
        {
            get
            {
                string result;
                if (this.Container.NumberOfContainers > 1)
                {
                    result = String.Format("{0} {1}x{2:F2} ml", this.Substance.Name, this.Container.NumberOfContainers, this.Container.ContainerCapacity);
                }
                else
                {
                    result = String.Format("{0} {1:F0} ml", this.Substance.Name, this.Container.ContainerCapacity);
                }

                return result;
            }
        }

        /// <summary>
        /// Gets or sets whether the Products2 is used by current user.
        /// </summary>
        /// <value>
        /// True if known to be used by the current user, false if known not to be used by the current user,
        /// null if there is no user in the context of the call that read this Products2.
        /// </value>
        [DataMember]
        public bool? UsedByUser { get; set; }
    }
}